﻿using erpWebapiBack.ApplicationDev.mytest;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace erpWebapiBack.ApplicationDev
{
    public class MsSqlDbContext : DbContext, IDisposable, IObjectContextAdapter
    {
        /// <summary>
        /// 初始化一个 使用指定数据连接名称或连接串 的数据访问上下文类 的新实例
        /// </summary>
        /// <param name="connString">连接字串</param>
        public MsSqlDbContext(string connString)
            : base(new SqlConnection(connString), true)
        {
            this.Configuration.AutoDetectChangesEnabled = false;
            this.Configuration.ValidateOnSaveEnabled = false;
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
        }

        public DbSet<mytestEntity> mytestEntities { get; set; }
    }
}
